﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PapersManage.aspx.cs" Inherits="OA.Exam.PapersManage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>维护试卷</title>
    <link href="../Themes/Default/Style.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" language="javascript">
            function checkAll() {
                var Myform = window.document.forms[0];
                for (var i = 0; i < Myform.elements.length; i++) {
                    var c = Myform.elements[i].type;
                    if (c == "checkbox" && document.all.chball.checked) {
                        Myform.elements[i].checked = true;
                    }
                    else {
                        Myform.elements[i].checked = false;
                    }
                }
            }

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
                <table width="98%">
            <tr>
                <td colspan="2" class="TitleZone">
                    维护试卷
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Label ID="LabPrompt" runat="server" Text="" ForeColor="Red"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="width:70%">
                    
                </td>
                <td style="width:30%">
                    <asp:Button ID="BtnAdd" runat="server" Text="新增" CssClass="closebtn" 
                        onclick="BtnAdd_Click" />&nbsp;&nbsp;
                    <asp:Button ID="BtnDelete" runat="server" Text="删除" CssClass="closebtn" 
                        OnClientClick="return confirm('确定要删除所选试卷吗？')" />&nbsp;&nbsp;
                    <asp:Button ID="BtnBegin" runat="server" Text="开始考试" CssClass="closebtn" 
                        onclick="BtnBegin_Click" OnClientClick="return confirm('开始考试后，试卷题目再无法修改，您确定已经设置好了题目，并开始本次考试吗？')" />&nbsp;&nbsp;
                    <asp:Button ID="BtnEnd" runat="server" Text="结束考试" CssClass="closebtn" 
                        onclick="BtnEnd_Click" OnClientClick="return confirm('结束考试后，试卷再无法使用，您要确定结束本次考试吗？')" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;&nbsp;试卷名称：
                    <asp:TextBox ID="TxtPaperName" runat="server" CssClass="inputText"></asp:TextBox>
                    &nbsp;&nbsp;<asp:Button ID="BtnSearcn" runat="server" Text="查询" 
                        CssClass="closebtn" onclick="BtnSearcn_Click" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="GridViewPapers" runat="server" AutoGenerateColumns="false" CssClass="GridViewStyle"
                    width="100%" AllowPaging="true" EmptyDataText="暂无试卷" DataKeyNames="PaperId,status" 
                        onrowcommand="GridViewPapers_RowCommand" 
                        onrowdatabound="GridViewPapers_RowDataBound" >
                        <Columns>
                            <asp:TemplateField>
                                <HeaderTemplate>
                                    <input id="chball" type="checkbox" onclick="checkAll()" />全选
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="ChbCheck" runat="server" />
                                </ItemTemplate>
                                <HeaderStyle Width="6%" HorizontalAlign="Left" />
                                <ItemStyle Width="6%" />
                            </asp:TemplateField>
                            <asp:HyperLinkField DataNavigateUrlFields="PaperId" DataNavigateUrlFormatString="../Exam/Front/ExamPaper.aspx?paperId={0}" Target="_blank" DataTextField="PaperName" HeaderText="试卷名称" ItemStyle-Width="46%" />
                            <asp:BoundField DataField="Score" HeaderText="总分" ItemStyle-Width="10%" />
                            <asp:BoundField DataField="ExamTime" HeaderText="时长" ItemStyle-Width="10%" />
                            <asp:TemplateField HeaderText="试卷状态">
                                <ItemTemplate>
                                    <script type="text/javascript" language="javascript">
                                        var ss = '<%#Eval("Status") %>';
                                        switch (ss) {
                                            case '1':
                                                document.write("未使用");
                                                break;
                                            case '2':
                                                document.write("考试中");
                                                break;
                                            case '3':
                                                document.write("考试结束");
                                                break;
                                            default:
                                                document.write('');
                                                break;
                                        }
                                    </script>
                                </ItemTemplate>
                                <ItemStyle Width="10%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="操作">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LbtnEdit" runat="server" CssClass="" CommandName="EditPaper" Enabled='<%#Eval("status").ToString()=="1"?true:false %>'>修改</asp:LinkButton>||
                                    <asp:LinkButton ID="LbtnDelete" runat="server" CssClass="" CommandName="DeletePaper" Enabled='<%#Eval("status").ToString()=="1"?true:false %>'>删除</asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle Width="10%" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="设置">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LbtnSet" runat="server" CssClass="" CommandName="SetPaper" Enabled='<%#Eval("status").ToString()=="1"?true:false %>'>设置大题</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle CssClass="GridViewFooterStyle" />
                        <RowStyle CssClass="GridViewRowStyle" />   
                        <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                        <PagerStyle CssClass="GridViewPagerStyle" />
                        <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                        <HeaderStyle CssClass="GridViewHeaderStyle" />
                    </asp:GridView>
                </td>
            </tr>
        </table>

    </div>
    </form>
</body>
</html>
